package leetcode.code1331;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int[] arrayRankTransform(int[] arr) {
		TreeSet<Integer> set = new TreeSet<>();
		for (int num : arr) {
			set.add(num);
		}
		Map<Integer, Integer> seqs = new HashMap<>();
		int id = 1;
		for (int num : set) {
			seqs.put(num, id++);
		}
		for (int i = 0; i < arr.length; i++) {
			arr[i] = seqs.get(arr[i]);
		}
		return arr;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
